﻿using System;
using System.Collections.Generic;

using Nest;
using Newtonsoft.Json;

namespace ES.Model
{
    /// <summary>
    /// 会员
    /// </summary>
    [ElasticsearchType(Name = "Associations.Associator")]
    public partial class Associator
    {
        /// <summary>
        /// 主键
        /// </summary>
        public long AssociatorId { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        public string RealName { get; set; }

        /// <summary>
        /// 称谓
        /// </summary>
        public string Appellation { get; set; }

        /// <summary>
        /// 手机号码
        /// </summary>
        public string Mobile { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 职位
        /// </summary>
        public string PosStatusEx { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 固话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        /// 身份证
        /// </summary>
        public string IDCard { get; set; }

        /// <summary>
        /// 微信
        /// </summary>
        public string WeiXin { get; set; }

        /// <summary>
        /// 兼容单会不报错-性别
        /// </summary>
        public string SexEx { get; set; }

        public string CountryEx { get; set; }

        /// <summary>
        /// 兼容单会不报错-微博
        /// </summary>
        public string Weibo { get; set; }

        /// <summary>
        /// 兼容单会不报错-备注
        /// </summary>
        public string Memo { get; set; }

        /// <summary>
        /// 生日
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime? BirthDay { get; set; }

        /// <summary>
        /// 导入选项的Id
        /// </summary>
        public long ImportResultId { get; set; }

        [Nest.Nested]
        public List<EnhanceWeiXin> EnhanceWeiXinList { get; set; }

        [Nest.Object]
        public EnhanceWeiXin EnhanceWeiXin { get; set; }

        /// <summary>
        /// QQ 
        /// </summary>
        public string QQ { get; set; }

        /// <summary>
        /// 公司
        /// </summary>
        public string Company { get; set; }

        /// <summary>
        /// 传真
        /// </summary>
        public string Fax { get; set; }

        /// <summary>
        /// 公司网址
        /// </summary>
        public string CompanyWebsite { get; set; }

        /// <summary>
        /// 会员编号
        /// </summary>
        public string AssociatorNum { get; set; }

        /// <summary>
        /// 报名表单值的版本号
        /// </summary>
        [Obsolete]
        public int FieldValueVersion { get; set; }

        /// <summary>
        /// 当前会员对应的字段值历史ID
        /// </summary>
        public long CurrentFieldValueGroupId { get; set; }

        /// <summary>
        /// 待审核对应的字段值历史ID
        /// </summary>
        public long NextFieldValueGroupId { get; set; }

        /// <summary>
        /// 自定义字段
        /// </summary>
        public Dictionary<string, string> ExtraFields { get; set; }

        /// <summary>
        /// ES反序列化时使用此字段
        /// JSON反序列化时使用此字段
        /// 新增和修改数据保存MongoDB时忽略此字段
        /// </summary>
        [JsonProperty("ExtraFieldsForES")]
        [Nest.Object(Name = "ExtraFieldsForES", Ignore = true)]
        public Dictionary<string, object> ExtraFieldsForES { get; set; }

        /// <summary>
        /// 会员类型Id
        /// </summary>
        public long LevelId { get; set; }

        /// <summary>
        /// 是否自动计算类型
        /// </summary>
        public bool IsDisabledLevel { get; set; }

        /// <summary>
        /// 会员类型值
        /// </summary>
        public int LevelRank { get; set; }

        /// <summary>
        /// 会员分类id
        /// </summary>
        public long AssociatorPayTypeId { get; set; }

        /// <summary>
        /// 会员分类名称
        /// </summary>
        public string AssociatorPayTypeName { get; set; }

        /// <summary>
        /// 会员类型名称
        /// </summary>
        public string LevelName { get; set; }

        /// <summary>
        /// 会员分组
        /// </summary>
        public List<long> GroupIds { get; set; }

        /// <summary>
        /// 分组一,分组二
        /// </summary>
        public string GroupNames { get; set; }

        /// <summary>
        /// 是否被加入黑名单
        /// </summary>
        public bool IsInBlackList { get; set; }

        /// <summary>
        /// 金额(余额)
        /// </summary>
        public double RechargeAmount { get; set; }

        /// <summary>
        /// 消费次数
        /// </summary>
        public double ConsumptionCount { get; set; }

        /// <summary>
        /// 消费金额
        /// </summary>
        public double ConsumptionAmount { get; set; }

        /// <summary>
        ///交易关闭数量
        /// </summary>
        public int TradingCloseNumber { get; set; }

        /// <summary>
        /// 会员申请-申请时间
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime AppliedAt { get; set; }

        /// <summary>
        /// 会员申请-审核时间
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime AuditAt { get; set; }

        /// <summary>
        /// 用户正是成为会员的时间
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime JoinAt { get; set; }

        /// <summary>
        /// 会员申请-付款时间
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime ApplyPaidAt { get; set; }

        /// <summary>
        ///  上次消费时间
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime LastConsumedAt { get; set; }

        /// <summary>
        /// 到期时间
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime ExpiredAt { get; set; }

        /// <summary>
        /// 会员信息修改-申请时间
        /// </summary>
        [Obsolete]
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime UpdateInfoApplyAt { get; set; }

        /// <summary>
        /// 会员信息修改-审核时间
        /// </summary>
        [Obsolete]
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime UpdateInfoAuditAt { get; set; }

        /// <summary>
        /// 省
        /// </summary>
        public string Province { get; set; }

        /// <summary>
        /// 市
        /// </summary>
        public string City { get; set; }

        /// <summary>
        /// 标签设置项目
        /// </summary>
        public List<long> TagSettingIds { get; set; }

        /// <summary>
        /// 标签
        /// </summary>
        public List<string> Tags { get; set; }

        /// <summary>
        /// 对应通讯录
        /// </summary>
        public long ContactId { get; set; }

        /// <summary>
        /// 会员状态列表
        /// </summary>
        public List<string> RemarkStates { get; set; }

        /// <summary>
        /// 会员选中的状态
        /// </summary>
        public string RemarkStateSelect { get; set; }

        /// <summary>
        /// 最后一次催付时间
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime ExpeditingRemindAt { get; set; }

        /// <summary>
        /// 创建
        /// </summary>
        public Associator()
        {
            GroupIds = new List<long>();
            TagSettingIds = new List<long>();
            Tags = new List<string>();
            ExtraFields = new Dictionary<string, string>();
            ExtraFieldsForES = new Dictionary<string, object>();
        }


        /// <summary>
        /// 是否黑名单
        /// </summary>
        public bool IsBlack { get; set; }

        /// <summary>
        /// 催付提醒时间
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime? ExpeditingRemindTime { get; set; }

        /// <summary>
        /// 续费提醒时间
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime? RenewRemindTime { get; set; }

        /// <summary>
        /// 会员到期提醒时间  （用于微信 判断是否发送过消息）
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime? WeixinExpirationReminderTime { get; set; }

        /// <summary>
        ///判断是否发送过生日提醒
        /// </summary>
        [Nest.Date(Format = "yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z||yyyy-MM-dd'T'HH:mm:ss||strict_date_optional_time", IgnoreMalformed = true)]
        public DateTime? BirthdayReminderTime { get; set; }

        /// <summary>
        /// 入会类型金额
        /// </summary>
        public double GradeMoney { get; set; }

        /// <summary>
        /// 是否享受总社的入会优惠。
        /// </summary>
        [Nest.Boolean(Ignore = true)]
        public bool? IsJoinGene { get; set; }

        public string DisplayGradeRuleValue { get; set; }

        /// <summary>
        /// 是否推送到第三方,
        /// </summary>
        [Nest.Boolean(Ignore = true)]
        public bool IsPushData { get; set; }

        /// <summary>
        /// 积分
        /// </summary>
        public int Integral { get; set; }

        /// <summary>
        /// 入社+报名时候需要传递EventId
        /// </summary>
        public long EventId { get; set; }

        /// <summary>
        /// 线下付款提示信息。
        /// </summary>
        public string OfflineMsg { get; set; }

        /// <summary>
        /// 是否需要短信验证码
        /// </summary>
        [Nest.Boolean(Ignore = true)]
        public bool IsNeedSms { get; set; }

        /// <summary>
        /// 验证码
        /// </summary>
        public string SmsCode { get; set; }

        /// <summary>
        /// 推荐人Id
        /// </summary>
        public long PromoterId { get; set; }

        /// <summary>
        /// 推荐人姓名
        /// </summary>
        public string PromoterName { get; set; }

        /// <summary>
        /// 推荐人手机号
        /// </summary>
        public string PromoterMobile { get; set; }


        /// <summary>
        /// 参加活动次数
        /// </summary>
        public int InActivitieNumber { get; set; }

        /// <summary>
        /// 已经签到次数
        /// </summary>
        public int SignedInNumber { get; set; }

        /// <summary>
        /// 未签到次数
        /// </summary>
        public int NotSignInNumber { get; set; }

        /// <summary>
        /// 到场率：已签到次数/参加活动总次数
        /// </summary>
        public double AttendanceRate { get; set; }

        /// <summary>
        /// 缺席率：未签到次数/参加活动总次数
        /// </summary>
        public double AbsenceRate { get; set; }

        /// <summary>
        /// OpendId
        /// </summary>
        public string OpenId { get; set; }

        /// <summary>
        /// 工号Id。
        /// </summary>
        public long PublicNumId { get; set; }

        /// <summary>
        /// 用来接收回调的地址。
        /// </summary>
        public string GoToUrl { get; set; }
    }
}
